package com.itlong.cloud.operate.resource;

import com.itlong.cloud.POJO.DTO.operate.OperateSaveSipClusterDTO;
import com.itlong.cloud.POJO.DTO.operate.OperateSipClusterPageDTO;
import com.itlong.cloud.POJO.VO.operate.OperateSipClusterVO;
import com.itlong.cloud.equip.operate.IOperateSipClusterServiceClient;
import com.itlong.cloud.operate.service.IOperateSipClusterService;
import com.itlong.cloud.utils.page.Page;
import org.slf4j.Logger;import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <desc>
 *     运营-运营管理-SIP集群管理露接口实现类。
 * <desc/>
 *
 * @createDate 2017/9/30.
 */
@RestController
public class OperateSipClusterServiceResource implements IOperateSipClusterServiceClient {

    private static final Logger LOG = LoggerFactory.getLogger(OperateSipClusterServiceResource.class);

    @Autowired
    IOperateSipClusterService iOperateSipClusterService;

     /**
      * <desc>
      *      保存SIP信息。
      * <desc/>
      *
      * @param  saveDTO 数据对象
      * @return  返回影响行数
      * @author shengen.T
      * @createDate 2017/9/30
      */
    @Override
    @RequestMapping(path = "/operate/marketer/sipCluster/saveSipInfo")
    public Integer saveSipInfo(@RequestBody  OperateSaveSipClusterDTO saveDTO) throws Exception{
      return iOperateSipClusterService.saveSipInfo(saveDTO);
    }

     /**
      * <desc>
      *      修改SIP信息。
      * <desc/>
      *
      * @param  saveDTO
      * @return
      * @author shengen.T
      * @createDate 2017/9/30
      */
    @Override
    @RequestMapping(path = "/operate/marketer/sipCluster/updateSipInfo" , method = RequestMethod.POST)
    public Integer updateSipInfo(@RequestBody OperateSaveSipClusterDTO saveDTO) throws Exception{
        return iOperateSipClusterService.updateSipInfo(saveDTO);
     }

      /**
       * <desc>
       *      设置SIP服务器状态。
       * <desc/>
       *
       * @param   sipId  SIP服务器ID
       * @param   status 状态
       * @return
       * @author shengen.T
       * @createDate 2017/9/30
       */
      /*  设置启用禁用暂时不需要
     @Override
     @RequestMapping(path = "/operate/marketer/sipCluster/setSipStatus/{sipId}/{status}",method = RequestMethod.GET)
     public Integer setSipStatus(@PathVariable("sipId") String sipId,@PathVariable("status") Integer status) throws Exception{
       return iOperateSipClusterService.setSipStatus(sipId,status);
     }
       */

      /**
       * <desc>
       *      获取单个SIP服务器信息。
       * <desc/>
       *
       * @param  sipId SIP服务器ID
       * @return
       * @author shengen.T
       * @createDate 2017/9/30
       */
     @Override
     @RequestMapping(path = "/operate/marketer/sipCluster/getSipInfo/{sipId}",method = RequestMethod.GET)
     public OperateSipClusterVO getSipInfo(@PathVariable("sipId") String sipId) throws Exception{
       return iOperateSipClusterService.getSipInfo(sipId);
     }

      /**
       * <desc>
       *      获取SIP服务器分页信息。
       * <desc/>
       *
       * @param  pageDTO  请求参数
       * @return
       * @author shengen.T
       * @createDate 2017/9/30
       */
    @Override
    @RequestMapping(path = "/operate/marketer/sipCluster/getSipInfoPage",method = RequestMethod.POST)
    public Page<OperateSipClusterVO> getSipInfoPage(@RequestBody OperateSipClusterPageDTO pageDTO) throws Exception{
        return iOperateSipClusterService.getSipInfoPage(pageDTO);
     }

}
